package cn.zan;

/**
 * @author Mxb
 * @version 1.0
 * @date 2020/5/7 14:20
 */
public class SingleObject {
    //创建 的一个对象
    private static SingleObject instance = new SingleObject();
    // 构造参数私有化，这样该类就不会被实例化
    private SingleObject(){}
    // 获取唯一可用的对象
    public static SingleObject getInstance(){
        return instance;
    }

    public void showMessage(){
        System.out.println("hello world singleObject");
    }
}
